package org.example.controller;
import org.example.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/EcoGlow")
public class Controller1 {
    @Autowired
    private Student student;

    @Value("${student.id}")
    private String theId;
    @Value("${student.name}")
    private String theName;
    @Value("${student.id}")
    private String thePasswd;

    @GetMapping("/write")
    public String write(){

        student.setId(theId);
        student.setPasswd(thePasswd);
        student.setName(theName);
        return "ok";
    }

    @GetMapping("/read")
    public String read() {
        return student.toString();
    }
}
